/*
 * Copyright (c) 2015 Apostolis Iakovakis, Nikos Karagiannis,
 * Nikos Krommydas & Malamas Malamidis. All rights reserved.
 *
 * This file is part of Rastaman.
 *
 * Rastaman is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * Rastaman is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Rastaman.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
package eap.pli24.rastaman.ui;

import eap.pli24.rastaman.ui.skins.SkinProvider;
import java.awt.Dimension;
import java.util.logging.Logger;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.SwingConstants;

/**
 * Η κλάση {@code SideBarPanel} είναι ένα {@code JPanel} για το πλευρικό τμήμα
 * του παραθύρου της εφαρμογής.
 *
 * @author Apostolis Iakovakis
 * @author Nikos Karagiannis
 * @author Nikos Krommydas
 * @author Malamas Malamidis
 */
public class SideBarPanel extends javax.swing.JPanel {

    // logger για την καταγραφή checked exceptions
    private static final Logger LOGGER = Logger.getLogger(MainFrameController.class.getName());

    /**
     * Creates new form SideBarPanel
     */
    public SideBarPanel() {
        initComponents();
        initFurther();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        filler1 = new Box.Filler(new Dimension(20, 20), new Dimension(20, 20), new Dimension(20, 20));
        rastamanLabel = new JLabel();
        filler2 = new Box.Filler(new Dimension(20, 40), new Dimension(20, 40), new Dimension(20, 40));
        creditsLabel = new JLabel();
        filler3 = new Box.Filler(new Dimension(20, 30), new Dimension(20, 30), new Dimension(20, 30));

        setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
        add(filler1);

        rastamanLabel.setHorizontalAlignment(SwingConstants.CENTER);
        rastamanLabel.setIcon(new ImageIcon(getClass().getResource("/eap/pli24/rastaman/resources/images/rastaman_200x200.png"))); // NOI18N
        rastamanLabel.setVerticalAlignment(SwingConstants.TOP);
        rastamanLabel.setAlignmentX(0.5F);
        rastamanLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        rastamanLabel.setVerticalTextPosition(SwingConstants.BOTTOM);
        add(rastamanLabel);
        add(filler2);

        creditsLabel.setVerticalAlignment(SwingConstants.TOP);
        creditsLabel.setAlignmentX(0.5F);
        creditsLabel.setMaximumSize(new Dimension(20, 20));
        creditsLabel.setVerticalTextPosition(SwingConstants.TOP);
        add(creditsLabel);
        add(filler3);
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private JLabel creditsLabel;
    private Box.Filler filler1;
    private Box.Filler filler2;
    private Box.Filler filler3;
    private JLabel rastamanLabel;
    // End of variables declaration//GEN-END:variables
    //
    // Ο δικός μας κώδικας αρχίζει εδώ, για να είναι
    // εμφανώς διαχωρισμένος από τον αυτόματα δημιουργούμενο
    //

    /**
     * Αρχικοποίεί περαιτέρω στοιχεία του UI.
     */
    private void initFurther() {
        this.setPreferredSize(new Dimension(SkinProvider.getInstance().getSkin().getSidebarWidth(), 0));
        this.setBackground(SkinProvider.getInstance().getSkin().getSidebarBackground());

        rastamanLabel.setVisible(SkinProvider.getInstance().getSkin().getRastamanVisible());
        rastamanLabel.setFont(SkinProvider.getInstance().getSkin().getRastamanFont());
        rastamanLabel.setForeground(SkinProvider.getInstance().getSkin().getRastamanForeground());
        String rastaman = "Rastaman!";
        rastamanLabel.setText(rastaman);

        String credits = "<html>a RAdio STAtion MANager application<br>"
                + "<br>"
                + "© 2015<br>"
                + "Αποστόλης Ιακωβάκης<br>"
                + "Νίκος Καραγιάννης<br>"
                + "Νίκος Κρομμύδας<br>"
                + "Μάλαμας Μαλαμίδης";
        creditsLabel.setMaximumSize(SkinProvider.getInstance().getSkin().getCreditsSize());
        creditsLabel.setFont(SkinProvider.getInstance().getSkin().getCreditsFont());
        creditsLabel.setForeground(SkinProvider.getInstance().getSkin().getCreditsForeground());
        creditsLabel.setText(credits);
    }
}
